<?php
/**
 * PHP Framework UI EntityGridItemActionType class
 * This class represents type metadata for an entity grid item action
 *
 * @author Andrew <andrew@vitche.com>
 * @author Frozen Rain <frozenrain@mail.ru>
 **/
class EntityGridItemActionType extends EntityGridActionType {

    private $_key_field = null;

    public function getKeyField() {
        return $this->_key_field;
    }

    public function setKeyField($strKeyField) {
        $this->_key_field = $strKeyField;
    }

    /**
     * TODO: Replace with a JSON call builder
     **/
    public function toString($key) {
        $strClass = $this->_class;
        if (!isset($strClass)) {
            $strClass = $this->_object->type->getClass();
        }
        $strKeyField = $this->_key_field;
        $arFields = array($this->_key_field);
        $arValues = array($key);
        $str = "Framework.DomainModel.Entity.call(\"$strClass\", \"$this->_method\", " . JSONSerializer::toString($arFields) . ", " . JSONSerializer::toString($arValues) . "); document.location = document.location;";
        return $str;
    }
}
?>